package com.lr.server.demo2;

import java.util.Map;

public class WebAPP {
  
	private static ServletContext setvletContext;
	static{
		setvletContext = new ServletContext();
		
		Map<String,String> mapping = setvletContext.getMapping();
		mapping.put("/login", "login");
		mapping.put("/reg", "register");
		
		Map<String,Servlet> servlet = setvletContext.getServlet();
		servlet.put("login", new LoginServlet());
		servlet.put("register", new RegisterServlet());
	}
	
	public static Servlet getSevlet(String url){
		if(null == url || url.trim().equals("")){
			return null;
		}
		return setvletContext.getServlet().get(setvletContext.getMapping().get(url));
	}
}
